﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
    public bool ctlFlag = false;
    public Player(int p)
    {
        point = p;
    }
    int point = 0;
    // Start is called before the first frame update
    void Start()
    {
        
    }
    public Platform platform;
    // Update is called once per frame
    void Update()
    {
        if (ctlFlag == false)
        {

            if (Input.GetKey(KeyCode.A)&&platform.outFlagL == false)
            {
                platform.transform.position = new Vector3(platform.transform.position.x - (3 * Time.deltaTime), platform.transform.position.y);
            }
            if (Input.GetKey(KeyCode.D) && platform.outFlagR == false)
            {
                platform.transform.position = new Vector3(platform.transform.position.x + (3 * Time.deltaTime), platform.transform.position.y);
            }
        }
        else
        {
            if (Input.GetKey(KeyCode.LeftArrow) && platform.outFlagL == false)
            {
                platform.transform.position = new Vector3(platform.transform.position.x - (3 * Time.deltaTime), platform.transform.position.y);
            }
            if (Input.GetKey(KeyCode.RightArrow) && platform.outFlagR == false)
            {
                platform.transform.position = new Vector3(platform.transform.position.x + (3 * Time.deltaTime), platform.transform.position.y);
            }
        }
    }
    public void addPoint()
    {
        point++;
    }
}
